{
	template:`
	<a-page-header title="开发者">
		<template #extra>
		</template>
		<a-card :hoverable="true" :bodyStyle="{padding:0}">
		    <a-tabs v-model:activeKey="activeKey" @change="tabChange">
		        <template #leftExtra>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</template>
		        <a-tab-pane key="model" tab="模型">
		            <div style="margin-top:-15px;margin-bottom:-1px;max-height:600px;overflow-y:auto;">
                        <a-collapse accordion ghost>
                            <a-collapse-panel v-for="model in models" :key="model.name">
                                <template #header>{{model.description}} <small>{{model.clazz}}</small></template>
                                <a-list :grid="{gutter:0,column:4}" item-layout="horizontal" :data-source="model.fields" size="small">
                                    <template #renderItem="{ item }">
                                        <a-list-item>
                                            <a-list-item-meta>
                                                <template #title>
                                                    <a-tag size="small" color="success" v-if="item.linkClazz">
                                                        <a-popover ><template #content>{{item.linkClazz}}</template>类</a-popover>
                                                    </a-tag>
                                                    <a-tag size="small" v-else>{{item.type}}{{item.type=='STRING'?('('+item.length+')'):''}}</a-tag>
                                                    {{item.field}}
                                                    <span v-if="item.notnull" style="color:#f21;">*</span>
                                                </template>
                                                <template #description>
                                                    <a-tag size="small" color="processing" v-if="item.dictType">
                                                        <a-popover ><template #content>{{item.dictType}}</template>字典</a-popover>
                                                    </a-tag>
                                                    <a-tag size="small" color="processing" v-if="item.dictOption">
                                                        <a-popover ><template #content>{{item.dictOption}}</template>选项</a-popover>
                                                    </a-tag>
                                                    {{item.description}}
                                                </template>
                                            </a-list-item-meta>
                                        </a-list-item>
                                    </template>
                                </a-list>
                            </a-collapse-panel>
                        </a-collapse>
                    </div>
		        </a-tab-pane>
		        <a-tab-pane key="action" tab="Action">
		            <div style="margin-top:-15px;margin-bottom:-1px;max-height:600px;overflow-y:auto;">
                        <a-collapse accordion :bordered="false" style="background-color:transparent;">
                            <a-collapse-panel v-for="action in actions" :key="action.className">
                                <template #header>{{action.title}} <small>{{action.description}}</small></template>
                                <a-collapse accordion ghost>
                                    <a-collapse-panel v-for="method in action.methods" :key="method.path">
                                        <template #header>{{method.title}} <small>{{method.description}}</small></template>
                                        <a-row type="flex" :gutter="16">
                                            <a-col :flex="3">
                                                <a-row type="flex" :gutter="16">
                                                    <a-col :flex="1">
                                                        <a-typography-paragraph :copyable="{text:method.path}">
                                                            <a-tag v-if="method.permission" color="warning">需鉴权</a-tag>
                                                            接口地址：<span class="text-lg">{{method.path}}</span>
                                                        </a-typography-paragraph>
                                                    </a-col>
                                                    <a-col>
                                                        <a-button type="primary warn" size="small" @click="toRequest(method)">在线调用</a-button>
                                                    </a-col>
                                                </a-row>
                                                <a-list v-if="method.params.length>0" :data-source="method.params" size="small" bordered >
                                                    <template #renderItem="{ item }">
                                                        <a-list-item>
                                                            <a-list-item-meta>
                                                                <template #title>
                                                                    <a-tag size="small">{{item.type}}{{item.type=='STRING'?('('+item.length+')'):''}}</a-tag>
                                                                    {{item.name}}
                                                                    <span v-if="item.notnull" style="color:#f21;">*</span>
                                                                    <a-tag size="small" color="processing" v-if="item.dictType">
                                                                        <a-popover ><template #content>{{item.dictType}}</template>字典{{item.multiple?'-多选':''}}</a-popover>
                                                                    </a-tag>
                                                                    <a-tag size="small" color="processing" v-if="item.dictOption">
                                                                        <a-popover ><template #content>{{item.dictOption}}</template>选项{{item.multiple?'-多选':''}}</a-popover>
                                                                    </a-tag>
                                                                    <a-tag size="small" color="processing" v-if="item.dictTreeType">
                                                                        <a-popover ><template #content>{{item.dictTreeType}}</template>字典树{{item.multiple?'-多选':''}}</a-popover>
                                                                    </a-tag>
                                                                    {{item.description}}
                                                                </template>
                                                            </a-list-item-meta>
                                                        </a-list-item>
                                                    </template>
                                                </a-list>
                                                <div v-else style="line-height:2;">无参数</div>
                                            </a-col>
                                            <a-col :flex="2">
                                                <a-divider orientation="left" style="margin-top:0;">结果</a-divider>
                                                <div v-if="''+method.result=='[object Object]'">
                                                    <json-val :json-val="method.result" :current-depth="0" :max-depth="1" :last="true"></json-val>
                                                </div>
                                                <div v-else v-text="method.result"></div>
                                            </a-col>
                                        </a-row>
                                    </a-collapse-panel>
                                </a-collapse>
                            </a-collapse-panel>
                        </a-collapse>
                    </div>
		        </a-tab-pane>
		        <a-tab-pane key="pageTemp" tab="表单模板">
		            <div id="pageTemp_page"><a-skeleton active /></div>
		        </a-tab-pane>
		        <a-tab-pane key="listMethod" tab="Action方法生成">
		            <div id="listMethod_page"><a-skeleton active /></div>
		        </a-tab-pane>
		        <a-tab-pane key="modelField" tab="Model字段生成">
		            <div id="modelField_page"><a-skeleton active /></div>
		        </a-tab-pane>
		    </a-tabs>
		</a-card>
	</a-page-header>
	<a-modal v-model:open="showSelectTable" :width="'800px'" :closable="false" :keyboard="false" :mask-closable="false" class="index-modal">
	    <a-page-header title="选择表模型和属性"  >
            <template #extra>
                <a-button type="primary" @click="selectTableDone">确认选择</a-button>
                <m-back @click="showSelectTable=false;">关闭</m-back>
            </template>
            <a-card :hoverable="true" :bodyStyle="{padding:'20px 20px 0'}">
                <template v-if="null==showSelected">
                    <block v-for="model in models">
                        <a-tag style="margin-bottom:8px;" @click="selectedModel(model)"><span class="text-red">{{getModelType(model)}} </span>{{model.clazz}} {{model.description}}</a-tag>
                    </block>
                </template>
                <template v-else>
                    <a-row>
                        <a-col :span="10">
                            <span>{{showSelected.clazz}}<br/>{{showSelected.description}}</span>
                            <a-button type="link" @click="showSelected=null">重新选择</a-button>
                            <block v-for="item in selectCheckedKeys">
                                <div v-if="showAllFieldMap[item]&&!showAllFieldMap[item].field.linkClazz">
                                    {{item}} : {{showAllFieldMap[item].title}}
                                </div>
                            </block>
                        </a-col>
                        <a-col :span="14">
                            <a-tree v-model:expandedKeys="selectExpandedKeys" checkable v-model:checkedKeys="selectCheckedKeys" :load-data="onSelectLoadData" :tree-data="selectTreeCol"/>
                        </a-col>
                    </a-row>
                </template>
            </a-card>
        </a-page-header>
	</a-modal>
	<!--<a-space>
        <a-button type="primary success" @click="selectManyModel(modelTest,'many','action/manage/adminLogin/selectUser','1000px','MODAL')">多选</a-button>
        <a-button type="primary warn" @click="selectOneModel(modelTest,'one','action/manage/adminLogin/selectUser?params[selectMode]=one','1000px','MODAL')">单选</a-button>
        <a-button type="primary" @click="selectOneAdmin(modelTest,'admin','','')">单选</a-button>
        <a-button type="primary" @click="selectManyAdmin(modelTest,'admins','','')">多选</a-button>
	</a-space>
	{{modelTest}}-->
	`,
	props: ['localeZh','param','parentVue'],
	data:function(){
		return {
		    activeKey:'model',
		    models:[],
		    actions:[],
		    loadTab:{"pageTemp":false,"listMethod":false},
		    showSelectTable:false,
		    showSelectTableCallback:null,
		    showSelected:null,
		    showSelectedCol:[],
		    showAllFieldMap:{},
		    selectTreeCol:[],
		    selectExpandedKeys:['model'],
		    selectCheckedKeys:[],
		    modelTest:{many:[],one:{},admin:{},admins:[]}
		};
	},
	mounted(){
	    this.models=this.param.models;
	    this.actions=this.param.actions;
	},
	methods:{
	    toRequest:function(method){
			this.openPage("page/base/developer/request.js",
				{method:method},
				function(flag,obj){
		        }.bind(this),
		        '1100px'
	        );
	    },
	    tabChange:function(key){
	        if(key=='pageTemp'&&!this.loadTab['pageTemp']){
	            this.loadTab['pageTemp']=true;
                this.loadPage("pageTemp_page","page/base/developer/pageTemp.js",{},
                    function(pv,v3){
                    }.bind(this)
                );
	        }else if(key=='listMethod'&&!this.loadTab['listMethod']){
	            this.loadTab['listMethod']=true;
                this.loadPage("listMethod_page","page/base/developer/listMethod.js",{},
                    function(pv,v3){
                    }.bind(this)
                );
	        }else if(key=='modelField'&&!this.loadTab['modelField']){
                this.loadTab['modelField']=true;
                 this.loadPage("modelField_page","page/base/developer/modelField.js",{},
                     function(pv,v3){
                     }.bind(this)
                 );
            }
	    },
	    getModelType:function(model){
	        if(model.clazz.indexOf('manage.model')==0) return "管理";
	        if(model.clazz.indexOf('flow.model')==0) return "流程";
	        if(model.clazz.indexOf('api.model')==0) return "接口";
	        if(model.clazz.indexOf('m.system.cache.model')==0) return "缓存";
	        return "业务";
	    },
	    getModel:function(clazz){
	        for(let i=0;i<this.models.length;i++){
	            if(this.models[i].clazz==clazz){
	                return this.models[i];
	            }
	        }
	        return null;
	    },
	    selectTableModel:function(fn){
	        this.showSelectTable=true;
	        this.showSelectTableCallback=fn;
	    },
	    selectedModel:function(model){
	        this.showSelected=model;
	        this.selectTreeCol=[];
	        this.selectCheckedKeys=[];
	        this.onSelectLoadData();
	    },
	    onSelectLoadData:function(treeNode){
	        let toSubNode=()=>{
	            if(treeNode){
	                let tree=[];
	                let model=this.getModel(treeNode.field.linkClazz);
	                for(let i=0;i<model.fields.length;i++){
	                    let f=model.fields[i];
	                    let key=treeNode.key+'.'+f.field;
	                    this.showAllFieldMap[key]={title:f.field+' '+f.description,key:key,field:f,isLeaf:null==f.linkClazz};
	                    tree.push(this.showAllFieldMap[key]);
	                }
	                treeNode.dataRef.children=tree;
	            }else{
	                let tree=[{title:'属性',key:'model',children:[]}];
	                for(let i=0;i<this.showSelected.fields.length;i++){
	                    let f=this.showSelected.fields[i];
	                    let key='model.'+f.field;
	                    this.showAllFieldMap[key]={title:f.field+' '+f.description,key:key,field:f,isLeaf:null==f.linkClazz};
	                    tree[0].children.push(this.showAllFieldMap[key]);
	                }
	                this.selectTreeCol=tree;
	            }
	        };
            return new Promise(resolve => {
                if (treeNode&&treeNode.dataRef.children) {
                    resolve();
                    return;
                }
                toSubNode();
                resolve();
            });
	    },
	    selectTableDone:function(){
	        if(this.showSelectTableCallback){
	            let arr=[];
	            for(let i=0;i<this.selectCheckedKeys.length;i++){
	                let key=this.selectCheckedKeys[i];
	                if(this.showAllFieldMap[key]&&!this.showAllFieldMap[key].field.linkClazz){
	                    arr.push(this.showAllFieldMap[key]);
	                }
	            }
	            this.showSelectTableCallback(this.showSelected,arr);
	        }
	        this.showSelectTable=false;
	    }
	}
}